package com.easylinkin.linkappapi.deviceservice.controller;



import com.easylinkin.linkappapi.annotation.CommonOperateLogAnnotate;
import com.easylinkin.linkappapi.deviceservice.entity.DeviceServiceTenantConfig;
import com.easylinkin.linkappapi.deviceservice.service.DeviceServiceTenantConfigService;
import com.easylinkin.linkappapi.operatelog.constant.LogConstant.LogModule;
import java.util.List;
import javax.annotation.Resource;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import site.morn.rest.RestBuilders;
import site.morn.rest.RestMessage;

/**
 * <p>
 * 设备服务租户个性化配置 前端控制器
 * </p>
 *
 * @author TongJie
 * @since 2020-10-28
 */
@RestController
@Api(value="设备服务租户个性化",tags={"设备服务租户个性化"})
@RequestMapping("/deviceservice/deviceServiceTenantConfig")
public class DeviceServiceTenantConfigController {


    @Resource
    private DeviceServiceTenantConfigService service;

    @ApiOperation("批量新增设备服务租户个性化配置")
    @PostMapping("batchSaveDeviceServiceTenantConfigs")
    @CommonOperateLogAnnotate(module = LogModule.DEVICE_SERVICE_TENANT_CONFIG, desc = "批量新增设备服务租户个性化配置")
    public RestMessage batchSaveDeviceServiceTenantConfigs(@RequestBody List<DeviceServiceTenantConfig> deviceServiceTenantConfigList) {
        service.batchSaveDeviceServiceTenantConfigs(deviceServiceTenantConfigList);
        return RestBuilders.successBuilder().build();
    }

    @ApiOperation("查询设备服务租户个性化配置")
    @PostMapping("getDeviceServiceTenantConfigs")
    public RestMessage getDeviceServiceTenantConfigs(@RequestBody DeviceServiceTenantConfig deviceServiceTenantConfig) {
        List<DeviceServiceTenantConfig> deviceServiceTenantConfigs = service.getDeviceServiceTenantConfigs(deviceServiceTenantConfig);
        return RestBuilders.successBuilder().data(deviceServiceTenantConfigs).build();
    }

}
